package com.tuozixuan.caffeine;

import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.LoadingCache;

public class EvictionBaseCapacityDemo {

	public static void main(String[] args) {
		
		// 基于缓存内的元素个数进行驱逐
		LoadingCache<String, String> cache = Caffeine.newBuilder().maximumSize(10_000).build(key -> "lisi");
		
		// 基于缓存内元素权重进行驱逐
		//Caffeine.newBuilder().maximumWeight(10_000).weigher((Key key, Graph graph) -> graph.vertices().size()).build(key -> "lisi");
		
	}

}
